/**
 * dart 中的 map
 */
void main() {
  var str = "helloworld";
  var list = str.split("");
  var map = {};
  for(var n in list) {
    if (map.containsKey(n)) {
      map[n] = map[n] + 1;
    } else {
      map[n] = 1;
    }
  }

  print(map);

  // 遍历和取值
  for(var k in map.keys) {
    print("${k} : ${map[k]}");
  }

  var list2 = map.entries.toList();
  list2.sort(((a, b) => a.value - b.value));
  print(list2);
}
